**/Replication do-file for Donno, "Elections and Democratization in Authoritarian Regimes"

*** Donno_AJPS13
	/*Reproduce main model in Stata*/
		use replication_elecdata_final_1 , clear
	
	drop if cyrdrop==1
	
sort ccode year
merge m:1 ccode using cites.dta 
drop if _m==2 
drop _merge
gen cites = year>=citesyr

gen study = ""
foreach n in orig noth fe time fet ct yfe cyfe {
gen method_`n' = ""
gen dv_`n' = ""
gen b_cites_`n' = .
gen se_cites_`n'= .
gen pval_cites_`n' = .
gen lo_cites_`n'=.
gen hi_cites_`n'=.
gen N_cites_`n'=.
}
gen studynum=.
gen timetrend=""
qui do cites.do

local ii = 1

*xtset

**/Table 1
* model 1
probit ed_trans cites gwf_compauth_lag1 chiefelec hm_incrun_fill eleccount_auth loggdppc_lag1 gdpgrowth_lag1 cee americas  ///
   if (gwf_compauth_lag1==1|gwf_hegauth_lag1==1)&cyrdrop~=1&pre_indep~=1&fh_elecdemoc_lag1~=1&gwf_prov_auth~=1, cluster(ccode) nolog
cites `ii' orig
probit ed_trans cites gwf_compauth_lag1 chiefelec hm_incrun_fill eleccount_auth loggdppc_lag1 gdpgrowth_lag1 cee americas  ///
   if (gwf_compauth_lag1==1|gwf_hegauth_lag1==1)&cyrdrop~=1&pre_indep~=1&fh_elecdemoc_lag1~=1&gwf_prov_auth~=1, cluster(ccode) nolog
cites `ii' noth
xtlogit ed_trans cites gwf_compauth_lag1 chiefelec hm_incrun_fill eleccount_auth loggdppc_lag1 gdpgrowth_lag1 cee americas ///
   if (gwf_compauth_lag1==1|gwf_hegauth_lag1==1)&cyrdrop~=1&pre_indep~=1&fh_elecdemoc_lag1~=1&gwf_prov_auth~=1, fe nolog
cites `ii' fe
probit ed_trans cites gwf_compauth_lag1 chiefelec hm_incrun_fill eleccount_auth loggdppc_lag1 gdpgrowth_lag1 cee americas year ///
  if (gwf_compauth_lag1==1|gwf_hegauth_lag1==1)&cyrdrop~=1&pre_indep~=1&fh_elecdemoc_lag1~=1&gwf_prov_auth~=1, cluster(ccode) nolog
cites `ii' time
xtlogit ed_trans cites gwf_compauth_lag1 chiefelec hm_incrun_fill eleccount_auth loggdppc_lag1 gdpgrowth_lag1 cee americas year ///
  if (gwf_compauth_lag1==1|gwf_hegauth_lag1==1)&cyrdrop~=1&pre_indep~=1&fh_elecdemoc_lag1~=1&gwf_prov_auth~=1, fe nolog
cites `ii' fet
logit ed_trans cites gwf_compauth_lag1 chiefelec hm_incrun_fill eleccount_auth loggdppc_lag1 gdpgrowth_lag1 cee americas i.ccode#c.year ///
  if (gwf_compauth_lag1==1|gwf_hegauth_lag1==1)&cyrdrop~=1&pre_indep~=1&fh_elecdemoc_lag1~=1&gwf_prov_auth~=1, cl(ccode) nolog
cites `ii' ct
xtreg ed_trans cites gwf_compauth_lag1 chiefelec hm_incrun_fill eleccount_auth loggdppc_lag1 gdpgrowth_lag1 cee americas i.year ///
   if (gwf_compauth_lag1==1|gwf_hegauth_lag1==1)&cyrdrop~=1&pre_indep~=1&fh_elecdemoc_lag1~=1&gwf_prov_auth~=1, fe vce(cl ccode)
cites `ii' cyfe
clogit ed_trans cites gwf_compauth_lag1 chiefelec hm_incrun_fill eleccount_auth loggdppc_lag1 gdpgrowth_lag1 cee americas ///
   if (gwf_compauth_lag1==1|gwf_hegauth_lag1==1)&cyrdrop~=1&pre_indep~=1&fh_elecdemoc_lag1~=1&gwf_prov_auth~=1, group(year) nolog vce(cl year)
cites `ii' yfe
replace studynum = `ii' if _n==`ii'   
local ii=`ii'+1

* model 2
probit ed_trans cites gwf_compauth_lag1 opp_coalitiontotal extcondpre chiefelec hm_incrun_fill eleccount_auth loggdppc_lag1 gdpgrowth_lag1 cee americas ///
   if (gwf_compauth_lag1==1|gwf_hegauth_lag1==1)&cyrdrop~=1&pre_indep~=1&fh_elecdemoc_lag1~=1&gwf_prov_auth~=1, cluster(ccode) nolog
cites `ii' orig
probit ed_trans cites gwf_compauth_lag1 opp_coalitiontotal extcondpre chiefelec hm_incrun_fill eleccount_auth loggdppc_lag1 gdpgrowth_lag1 cee americas ///
   if (gwf_compauth_lag1==1|gwf_hegauth_lag1==1)&cyrdrop~=1&pre_indep~=1&fh_elecdemoc_lag1~=1&gwf_prov_auth~=1, cluster(ccode) nolog
cites `ii' noth
xtlogit ed_trans cites gwf_compauth_lag1 opp_coalitiontotal extcondpre chiefelec hm_incrun_fill eleccount_auth loggdppc_lag1 gdpgrowth_lag1 cee ///
   americas if (gwf_compauth_lag1==1|gwf_hegauth_lag1==1)&cyrdrop~=1&pre_indep~=1&fh_elecdemoc_lag1~=1&gwf_prov_auth~=1, fe nolog
cites `ii' fe
probit ed_trans cites gwf_compauth_lag1 opp_coalitiontotal extcondpre chiefelec hm_incrun_fill eleccount_auth loggdppc_lag1 gdpgrowth_lag1 ///
  cee americas year if (gwf_compauth_lag1==1|gwf_hegauth_lag1==1)&cyrdrop~=1&pre_indep~=1&fh_elecdemoc_lag1~=1&gwf_prov_auth~=1, cluster(ccode) nolog
cites `ii' time
xtlogit ed_trans cites gwf_compauth_lag1 opp_coalitiontotal extcondpre chiefelec hm_incrun_fill eleccount_auth loggdppc_lag1 gdpgrowth_lag1 ///
  cee americas year if (gwf_compauth_lag1==1|gwf_hegauth_lag1==1)&cyrdrop~=1&pre_indep~=1&fh_elecdemoc_lag1~=1&gwf_prov_auth~=1, fe nolog
cites `ii' fet
logit ed_trans cites gwf_compauth_lag1 opp_coalitiontotal extcondpre chiefelec hm_incrun_fill eleccount_auth loggdppc_lag1 gdpgrowth_lag1 ///
  cee americas i.ccode#c.year if (gwf_compauth_lag1==1|gwf_hegauth_lag1==1)&cyrdrop~=1&pre_indep~=1&fh_elecdemoc_lag1~=1&gwf_prov_auth~=1, cl(ccode) nolog
cites `ii' ct
xtreg ed_trans cites gwf_compauth_lag1 opp_coalitiontotal extcondpre chiefelec hm_incrun_fill eleccount_auth loggdppc_lag1 gdpgrowth_lag1 cee ///
   americas i.year if (gwf_compauth_lag1==1|gwf_hegauth_lag1==1)&cyrdrop~=1&pre_indep~=1&fh_elecdemoc_lag1~=1&gwf_prov_auth~=1, fe vce(cl ccode)
cites `ii' cyfe
clogit ed_trans cites gwf_compauth_lag1 opp_coalitiontotal extcondpre chiefelec hm_incrun_fill eleccount_auth loggdppc_lag1 gdpgrowth_lag1 cee ///
   americas if (gwf_compauth_lag1==1|gwf_hegauth_lag1==1)&cyrdrop~=1&pre_indep~=1&fh_elecdemoc_lag1~=1&gwf_prov_auth~=1, group(year) nolog vce(cl year)
cites `ii' yfe
replace studynum = `ii' if _n==`ii'   
local ii=`ii'+1

* model 3
xi: probit ed_trans cites i.gwf_compauth_lag1*opp_coalitiontotal i.gwf_compauth_lag1*extcondpre chiefelec hm_incrun_fill eleccount_auth loggdppc_lag1 ///
   gdpgrowth_lag1 cee americas if (gwf_compauth_lag1==1|gwf_hegauth_lag1==1)&cyrdrop~=1&pre_indep~=1&fh_elecdemoc_lag1~=1&gwf_prov_auth~=1, cluster(ccode) nolog
cites `ii' orig
xi: probit ed_trans cites i.gwf_compauth_lag1*opp_coalitiontotal i.gwf_compauth_lag1*extcondpre chiefelec hm_incrun_fill eleccount_auth loggdppc_lag1 ///
   gdpgrowth_lag1 cee americas if (gwf_compauth_lag1==1|gwf_hegauth_lag1==1)&cyrdrop~=1&pre_indep~=1&fh_elecdemoc_lag1~=1&gwf_prov_auth~=1, cluster(ccode) nolog
cites `ii' noth
xi: xtlogit ed_trans cites i.gwf_compauth_lag1*opp_coalitiontotal i.gwf_compauth_lag1*extcondpre chiefelec hm_incrun_fill eleccount_auth ///
   loggdppc_lag1 gdpgrowth_lag1 cee americas if (gwf_compauth_lag1==1|gwf_hegauth_lag1==1)&cyrdrop~=1&pre_indep~=1&fh_elecdemoc_lag1~=1&gwf_prov_auth~=1, fe nolog iter(100)
cites `ii' fe
xi: probit ed_trans cites i.gwf_compauth_lag1*opp_coalitiontotal i.gwf_compauth_lag1*extcondpre chiefelec hm_incrun_fill eleccount_auth ///
  loggdppc_lag1 gdpgrowth_lag1 cee americas year if (gwf_compauth_lag1==1|gwf_hegauth_lag1==1)&cyrdrop~=1&pre_indep~=1&fh_elecdemoc_lag1~=1&gwf_prov_auth~=1 ///
  , cluster(ccode) nolog
cites `ii' time
 xi: xtlogit ed_trans cites i.gwf_compauth_lag1*opp_coalitiontotal i.gwf_compauth_lag1*extcondpre chiefelec hm_incrun_fill eleccount_auth ///
  loggdppc_lag1 gdpgrowth_lag1 cee americas year if (gwf_compauth_lag1==1|gwf_hegauth_lag1==1)&cyrdrop~=1&pre_indep~=1&fh_elecdemoc_lag1~=1&gwf_prov_auth~=1, fe nolog iter(100)
cites `ii' fet 
 logit ed_trans cites i.gwf_compauth_lag1##i.opp_coalitiontotal i.gwf_compauth_lag1##i.extcondpre chiefelec hm_incrun_fill eleccount_auth ///
  loggdppc_lag1 gdpgrowth_lag1 cee americas i.ccode#c.year if (gwf_compauth_lag1==1|gwf_hegauth_lag1==1)&cyrdrop~=1&pre_indep~=1&fh_elecdemoc_lag1~=1&gwf_prov_auth~=1, cl(ccode) nolog iter(100)
cites `ii' ct
xi: xtreg ed_trans cites i.gwf_compauth_lag1*opp_coalitiontotal i.gwf_compauth_lag1*extcondpre chiefelec hm_incrun_fill eleccount_auth ///
   loggdppc_lag1 gdpgrowth_lag1 cee americas i.year if (gwf_compauth_lag1==1|gwf_hegauth_lag1==1)&cyrdrop~=1&pre_indep~=1&fh_elecdemoc_lag1~=1&gwf_prov_auth~=1, fe vce(cl ccode)
cites `ii' cyfe
xi: clogit ed_trans cites i.gwf_compauth_lag1*opp_coalitiontotal i.gwf_compauth_lag1*extcondpre chiefelec hm_incrun_fill eleccount_auth ///
   loggdppc_lag1 gdpgrowth_lag1 cee americas if (gwf_compauth_lag1==1|gwf_hegauth_lag1==1)&cyrdrop~=1&pre_indep~=1&fh_elecdemoc_lag1~=1&gwf_prov_auth~=1, group(year) nolog iter(100) vce(cl year)
cites `ii' yfe
replace studynum = `ii' if _n==`ii'   
local ii=`ii'+1

* model 4
probit ed_trans cites gwf_compauth_lag1 chiefelec hm_incrun_fill eleccount_auth loggdppc_lag1 gdpgrowth_lag1 cee americas hm_incpartylose_chief_lag1el ///
    flaws_intens priorlib_fh regopen_lag2yravg if (gwf_compauth_lag1==1|gwf_hegauth_lag1==1)&cyrdrop~=1&pre_indep~=1&fh_elecdemoc_lag1~=1&gwf_prov_auth~=1, cluster(ccode) nolog
cites `ii' orig
probit ed_trans cites gwf_compauth_lag1 chiefelec hm_incrun_fill eleccount_auth loggdppc_lag1 gdpgrowth_lag1 cee americas hm_incpartylose_chief_lag1el ///
    flaws_intens priorlib_fh regopen_lag2yravg if (gwf_compauth_lag1==1|gwf_hegauth_lag1==1)&cyrdrop~=1&pre_indep~=1&fh_elecdemoc_lag1~=1&gwf_prov_auth~=1, cluster(ccode) nolog
cites `ii' noth
xtlogit ed_trans cites gwf_compauth_lag1 chiefelec hm_incrun_fill eleccount_auth loggdppc_lag1 gdpgrowth_lag1  hm_incpartylose_chief_lag1el ///
    flaws_intens priorlib_fh regopen_lag2yravg if (gwf_compauth_lag1==1|gwf_hegauth_lag1==1)&cyrdrop~=1&pre_indep~=1&fh_elecdemoc_lag1~=1&gwf_prov_auth~=1, fe nolog iter(100)
cites `ii' fe
probit ed_trans cites gwf_compauth_lag1 chiefelec hm_incrun_fill eleccount_auth loggdppc_lag1 gdpgrowth_lag1 cee americas ///
  hm_incpartylose_chief_lag1el flaws_intens priorlib_fh regopen_lag2yravg year ///
  if (gwf_compauth_lag1==1|gwf_hegauth_lag1==1)&cyrdrop~=1&pre_indep~=1&fh_elecdemoc_lag1~=1&gwf_prov_auth~=1, cluster(ccode) nolog
cites `ii' time
xtlogit ed_trans cites gwf_compauth_lag1 chiefelec hm_incrun_fill eleccount_auth loggdppc_lag1 gdpgrowth_lag1  hm_incpartylose_chief_lag1el ///
  flaws_intens priorlib_fh regopen_lag2yravg year if (gwf_compauth_lag1==1|gwf_hegauth_lag1==1)&cyrdrop~=1&pre_indep~=1&fh_elecdemoc_lag1~=1&gwf_prov_auth~=1, fe nolog iter(100)
cites `ii' fet
logit ed_trans cites gwf_compauth_lag1 chiefelec hm_incrun_fill eleccount_auth loggdppc_lag1 gdpgrowth_lag1  hm_incpartylose_chief_lag1el ///
 flaws_intens priorlib_fh regopen_lag2yravg i.ccode#c.year if (gwf_compauth_lag1==1|gwf_hegauth_lag1==1)&cyrdrop~=1&pre_indep~=1&fh_elecdemoc_lag1~=1&gwf_prov_auth~=1,  nolog iter(100) vce(cl ccode)
cites `ii' ct
xtreg ed_trans cites gwf_compauth_lag1 chiefelec hm_incrun_fill eleccount_auth loggdppc_lag1 gdpgrowth_lag1  hm_incpartylose_chief_lag1el ///
    flaws_intens priorlib_fh regopen_lag2yravg i.year if (gwf_compauth_lag1==1|gwf_hegauth_lag1==1)&cyrdrop~=1&pre_indep~=1&fh_elecdemoc_lag1~=1&gwf_prov_auth~=1, fe vce(cl ccode)
cites `ii' cyfe
clogit ed_trans cites gwf_compauth_lag1 chiefelec hm_incrun_fill eleccount_auth loggdppc_lag1 gdpgrowth_lag1  hm_incpartylose_chief_lag1el ///
    flaws_intens priorlib_fh regopen_lag2yravg if (gwf_compauth_lag1==1|gwf_hegauth_lag1==1)&cyrdrop~=1&pre_indep~=1&fh_elecdemoc_lag1~=1&gwf_prov_auth~=1, group(year) nolog iter(100) vce(cl year)
cites `ii' yfe
replace studynum = `ii' if _n==`ii'   
local ii=`ii'+1



* model 5
xi: probit ed_trans cites i.gwf_compauth_lag1*opp_coalitiontotal i.gwf_compauth_lag1*extcondpre chiefelec hm_incrun_fill eleccount_auth loggdppc_lag1 ///
   gdpgrowth_lag1 cee americas if (gwf_compauth_lag1==1|gwf_hegauth_lag1==1)&cyrdrop~=1&pre_indep~=1&fh_elecdemoc_lag1~=1&gwf_prov_auth~=1, cluster(ccode) nolog
cites `ii' orig
xi: probit ed_trans cites i.gwf_compauth_lag1*opp_coalitiontotal i.gwf_compauth_lag1*extcondpre chiefelec hm_incrun_fill eleccount_auth loggdppc_lag1 ///
   gdpgrowth_lag1 cee americas if (gwf_compauth_lag1==1|gwf_hegauth_lag1==1)&cyrdrop~=1&pre_indep~=1&fh_elecdemoc_lag1~=1&gwf_prov_auth~=1, cluster(ccode) nolog
cites `ii' noth
xi: xtlogit ed_trans cites i.gwf_compauth_lag1*opp_coalitiontotal i.gwf_compauth_lag1*extcondpre chiefelec hm_incrun_fill eleccount_auth ///
   loggdppc_lag1 gdpgrowth_lag1 cee americas if (gwf_compauth_lag1==1|gwf_hegauth_lag1==1)&cyrdrop~=1&pre_indep~=1&fh_elecdemoc_lag1~=1&gwf_prov_auth~=1, fe nolog iter(100)
cites `ii' fe
xi: probit ed_trans cites i.gwf_compauth_lag1*opp_coalitiontotal i.gwf_compauth_lag1*extcondpre chiefelec hm_incrun_fill eleccount_auth ///
 loggdppc_lag1 gdpgrowth_lag1 cee americas year if (gwf_compauth_lag1==1|gwf_hegauth_lag1==1)&cyrdrop~=1&pre_indep~=1&fh_elecdemoc_lag1~=1&gwf_prov_auth~=1, ///
 cluster(ccode) nolog
cites `ii' time
xi: xtlogit ed_trans cites i.gwf_compauth_lag1*opp_coalitiontotal i.gwf_compauth_lag1*extcondpre chiefelec hm_incrun_fill eleccount_auth ///
  loggdppc_lag1 gdpgrowth_lag1 cee americas year if (gwf_compauth_lag1==1|gwf_hegauth_lag1==1)&cyrdrop~=1&pre_indep~=1&fh_elecdemoc_lag1~=1&gwf_prov_auth~=1, fe nolog iter(100)
cites `ii' fet
xi: xtreg ed_trans cites i.gwf_compauth_lag1*opp_coalitiontotal i.gwf_compauth_lag1*extcondpre chiefelec hm_incrun_fill eleccount_auth ///
   loggdppc_lag1 gdpgrowth_lag1 cee americas i.year if (gwf_compauth_lag1==1|gwf_hegauth_lag1==1)&cyrdrop~=1&pre_indep~=1&fh_elecdemoc_lag1~=1&gwf_prov_auth~=1, fe vce(cl ccode) 
cites `ii' cyfe
xi: clogit ed_trans cites i.gwf_compauth_lag1*opp_coalitiontotal i.gwf_compauth_lag1*extcondpre chiefelec hm_incrun_fill eleccount_auth ///
   loggdppc_lag1 gdpgrowth_lag1 cee americas if (gwf_compauth_lag1==1|gwf_hegauth_lag1==1)&cyrdrop~=1&pre_indep~=1&fh_elecdemoc_lag1~=1&gwf_prov_auth~=1, group(year) nolog iter(100) vce(cl year)
cites `ii' yfe
replace studynum = `ii' if _n==`ii'   
local ii=`ii'+1

replace study = "Donno" if studynum~=. 	

keep study-timetrend
drop if studynum==.
compress
save donno.dta , replace


